package com.example.bozai.util;

import java.util.ArrayList;
import java.util.List;
public class CommonUtil {



    //将List<String>集合转化为String
    public static String ListToString(List<String> list){
        String result="";
        if (list.size()>0&&list!=null){
            for (String str:list){
                result=result+str+",";
            }
            result.substring(0,result.length()-1);
        }
        return result;
    }



    // "a,b,c"转化为List
    public static List<String> StrToList(String str){
        String[] strs = str.split(",");
        List<String> list=new ArrayList<>();
        for (int i = 0; i < strs.length; i++) {
            list.add(strs[i]) ;
        }
        return list;
    }




    //提取字符串中的数字
    public static String filterNumber(String str){
        if (null!=str){
            str=str.replaceAll("[^(0-9)]", "");
        }
        return str;
    }



}
